import React from "react";
import Child1 from "./Child1";
import Child2 from "./Child2";

export default class Parent extends React.Component{
    constructor(){
        super()
        this.state={
            money:1
        }
    }

    render(){
        return(
            <div>
                <h1>Parent</h1>
                <input type="number" value={this.state.money} onChange={this.onChangeHandler} />
                <Child1 money={this.state.money} />
                <Child2 money={this.state.money}/>
            </div>
        )
    }

    onChangeHandler=(e)=>{
        this.setState({
            money:e.target.value
        })
    }
}